#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H

#include "config/configgroup.h"

#include <map>
#include <string>
#include <vector>
#include <list>

using namespace std; 

typedef enum
{
    None = 0,
    Directories = 1,
    Files = 2,
    ShowDotFiles = 4
} FileTypes;

/**
 * Resource Manager is a singleton class which contains basically a map which 
 * associates names with directories.
 */
class ResourceManager
{
    public:
        /**
         * Destructor. Doesn't do much really.
         */
        ~ResourceManager();
        
        /**
         * Pointer to the only instance of this class (as this is a singleton).
         */
        static ResourceManager& self();
				static bool exists();
        
        /**
         * Stores internally the resource with a given name and value.
         */
        void addResource(const string& name, const string& resource);
        
        /**
         * Returns the resource associated with the given name. Returns "" if
         * it's not found.
         */
        string getResource(const string& name);
        
        /**
         * Returns whether the given name has a resource associated or not.
         */
        bool hasResource(const string& name);
        
        /**
         * Removes the association between the given name and its resource value
         * if it's stored internally.
         */
        void removeResource(const string& name);
        
        /**
         * Saves all the resources in a config group.
         */
        void saveProperties(ConfigGroup& groupConfig);
        
        /**
         * Restores resources from a config group.
         */
        void restoreProperties(ConfigGroup& groupConfig);
        
        /**
         * Returns the resource associated with the given name. Returns "" if
         * it's not found. Same as @ref getResource().
         */
        string operator[](const string& name);
    protected:
        /**
         * Constructor of the class. Doesn't do much really.
         */
        ResourceManager();
        
        /// Map containg the associations between names and resources.
        map<string, string> m_resources;
        
        /// Pointer to the only possible instance of this singleton class.
        static ResourceManager* m_self;
};

#endif
